const Koa = require('koa');
const axios = require('axios');
const instance = axios.create({});
let app =  new Koa();

app.use(async (ctx,next) => {
    const start = Date.now();
    await next();
    
    console.log('请求时间',Date.now() - start);
    // console.log(ctx.state.baiduHTML);
    ctx.status = 200;
})

app.use(async (ctx,next) => {
    
    ctx.state.baiduHTML = await instance.get('https://www.baidu.com');
    
})


app.listen(1314,() => {
    console.log('服务启动起来了','http://localhost:1314');
})